package com.koudai.finance.controller;

import com.koudai.finance.service.StockService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Description: 股票模块
 * @author: ls
 * @Date: 2020/7/8 16:12
 */
@Api(tags = "股票模块")
@RestController
@RequestMapping("/stock")
@Validated
public class StockController {

    @Resource
    private StockService stockServiceImpl;

    @ApiOperation(value = "获取推荐的股票")
    @PostMapping("/getList")
    public Map<String, Object> getList() {
        return stockServiceImpl.getList();
    }

    @ApiOperation(value = "同步股票代码")
    @PostMapping("/syncCode")
    public void syncCode() {
        stockServiceImpl.syncCode();
    }

    @ApiOperation(value = "同步周线历史数据")
    @PostMapping("/syncWeekData")
    public void syncWeekData() {
        stockServiceImpl.syncWeekData();
    }

    @ApiOperation(value = "计算有机会的股票")
    @PostMapping("/computeChance")
    public void computeChance() {
        stockServiceImpl.computeChance();
    }
}
